{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## else statement"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Must be after an if or elif statement. There can be at most one else statement. Will only be executed if all the \"if\" and \"elif\" statements above it are False. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "num = 1\n",
    "if num > 3 :\n",
    "    print(\"Hi\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "number is not greater than 3\n"
     ]
    }
   ],
   "source": [
    "\"\"\"We will execute what is inside the else statement\n",
    "because num is not greater than 3\n",
    "\"\"\"\n",
    "num = 1\n",
    "if num > 3 :\n",
    "    print(\"Hi\")\n",
    "else: \n",
    "    print(\"number is not greater than 3\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hi\n"
     ]
    }
   ],
   "source": [
    "\"\"\"We will execute what is inside the if statement because num > 4\"\"\"\n",
    "num = 4\n",
    "if num > 3 :\n",
    "    print(\"Hi\")\n",
    "else: \n",
    "    print(\"number is not greater than 3\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<b>Task</b>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1. Assign num to an integer value. \n",
    "2. Write an if else combination that will print \"Your integer is even\" if the integer is even. Otherwise, print \"Your integer is odd\". "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Hint: Any integer that can be divided exactly by 2 is an even number (examples: 2, 4, 6). Any integer that cannot be divided exactly by 2 is an odd number (examples: 1, 3, 5). Use the modulo operator (%) which returns the remainder of the division of the number to the left by the number on its right. \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Your number is odd\n"
     ]
    }
   ],
   "source": [
    "num = 3\n",
    "if num % 2 == 0:\n",
    "    print(\"Your integer is even\")\n",
    "else: \n",
    "    print(\"Your integer is odd\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**if this tutorial doesn't cover what you are looking for, please leave a comment on the youtube video and I will try to cover what you are interested in. (Please subscribe if you can!)**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://www.youtube.com/watch?v=e9ZMSHYwtDM"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [conda env:py36]",
   "language": "python",
   "name": "conda-env-py36-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
